//import org.springframework.context.annotation.Import;
//
//@Import(StrategyConfiguration.class)
//public class ApplicationConfig {
//}
//
//import org.springframework.context.annotation.ImportSelector;
//import org.springframework.core.type.AnnotationMetadata;
//
//public class StrategyConfiguration implements ImportSelector {
//    @Override
//    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
//        // 扫描并返回所有带有特定注解的类
//        Set<Class<?>> classes = scanForClassesAnnotatedWith("com.macro.mall.demo.design.pattern.strategy", StrategyRealization.class);
//        return classes.stream().map(Class::getName).toArray(String[]::new);
//    }
//
//    private Set<Class<?>> scanForClassesAnnotatedWith(String basePackage, Class<? extends Annotation> annotation) {
//        ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
//        provider.addIncludeFilter(new AnnotationTypeFilter(annotation));
//        return provider.findCandidateComponents(basePackage).stream()
//                .map(beanDefinition -> ClassUtils.resolveClassName(beanDefinition.getBeanClassName(), null))
//                .collect(Collectors.toSet());
//    }
//}
